package com.xlongwei.gservice.handler;

import java.nio.ByteBuffer;
import java.time.Instant;

import com.networknt.rpc.HybridHandler;
import com.networknt.rpc.ReflectHandler;
import com.networknt.rpc.router.ServiceHandler;
import com.networknt.utility.DateUtil;
import com.networknt.utility.HybridUtils;

import io.undertow.server.HttpServerExchange;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@ServiceHandler(id = "xlongwei.com/gservice/reflect/0.0.1")
public class Reflect extends ReflectHandler implements HybridHandler {

	@Override
	public void init() {
		log.info("{} init", getClass().getName());
	}

	public ByteBuffer datetime(HttpServerExchange exchange, Object object) {
		return HybridUtils.toByteBuffer("{\"datetime\":\"" + DateUtil.formatIso8601Date(Instant.now()) + "\"}");
	}

}
